package test;

import org.ddmf.person.model.People;
import org.ddmf.person.service.PeopleService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.ddmf.person.dao.PeopleDao;


/**
 * Spring bean測試
 * @author JXYEHX
 *
 */
public class Beantest {

	
	public static void main(String[] args)  {
		ClassPathXmlApplicationContext appctx = (ClassPathXmlApplicationContext)getCtx();
		System.out.println(appctx.getDisplayName()+"  START");

//		PeopleService ace = (PeopleService)appctx.getBean("peopleService");
//		People p = ace.getPeople("葉瀚鴻");
//		System.out.println("result:"+p.getItem_id());
		PeopleDao ace = (PeopleDao)appctx.getBean("peopleDao");
//		System.out.println("result:"+ace.getPeopleByUsername("1").get(0).getNames());
	
		System.out.println(appctx.getDisplayName()+"  END");
		
		System.exit(0);

	}

	public static ApplicationContext getCtx()
	{
		String[] paths = { "spring/*.xml" };
		ApplicationContext ctx =new ClassPathXmlApplicationContext(paths);
		return ctx;
	}

	
}
